package com.b511.swpu.cementbackend.repository;

import com.b511.swpu.cementbackend.entity.SYS_DATA_VALIDATE_RULE;
import com.b511.swpu.cementbackend.entity.Sys_Module_Data;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public  interface SYS_Data_Validate_RuleRepository extends JpaRepository<SYS_DATA_VALIDATE_RULE, String> {
    List<SYS_DATA_VALIDATE_RULE> findByTableName(String tableName);


    @Query(value="SELECT * FROM SYS_DATA_VALIDATE_RULE WHERE TABLENAME = :tableName AND FIELDNAME = :filedName", nativeQuery=true)
    SYS_DATA_VALIDATE_RULE dataRuleByTableNameAndFiledName(@Param("tableName") String tableName, @Param("filedName") String filedName);

    @Query(value="SELECT FIELDNAME FROM SYS_DATA_VALIDATE_RULE WHERE TABLENAME = :tableName", nativeQuery=true)
    List<String> fieldName(@Param("tableName") String tableName);
}
